---
title: Teradata
sidebarTitle: Teradata
---

This is the implementation of the Teradata data handler for MindsDB.

[Teradata Vantage Advanced SQL Engine](https://docs.teradata.com/r/Teradata-VantageTM-Advanced-SQL-Engine-Release-Summary/June-2022/Introduction/What-is-Teradata-Vantage) (formerly known as Teradata Database) is a connected multi-cloud data platform offering for enterprise analytics, that enables users to solve complex data challenges from start to scale. It supports huge data warehouse applications and was designed with a patented massively parallel processing (MPP) architecture. [Read more].

## Prerequisites

Before proceeding, ensure the following prerequisites are met:

1. Install MindsDB [locally via Docker](https://docs.mindsdb.com/setup/self-hosted/docker) or use [MindsDB Cloud](https://cloud.mindsdb.com/).
2. To connect Teradata to MindsDB, install the required dependencies following [this instruction](/setup/self-hosted/docker#install-dependencies).
3. Install or ensure access to Teradata.

## Implementation

This handler is implemented using `teradatasql`, the Python driver for Teradata.

The required arguments to establish a connection are as follows:

* `host` is the host name or IP address of the Teradata Vantage instance.
* `user` specifies the user name.
* `password` specifies the password for the user.
* `database` sets the database for the connection.

## Usage

You can use the below SQL statements to create a database in Teradata called `HR` and a table called `Employees`.

```sql
CREATE
DATABASE HR
AS PERMANENT = 60e6, -- 60MB
   SPOOL = 120e6; -- 120MB

CREATE
SET TABLE HR.Employees (
   GlobalID INTEGER,
   FirstName VARCHAR(30),
   LastName VARCHAR(30),
   DateOfBirth DATE FORMAT 'YYYY-MM-DD',
   JoinedDate DATE FORMAT 'YYYY-MM-DD',
   DepartmentCode BYTEINT
)
UNIQUE PRIMARY INDEX ( GlobalID );

INSERT INTO HR.Employees (GlobalID,
                          FirstName,
                          LastName,
                          DateOfBirth,
                          JoinedDate,
                          DepartmentCode)
VALUES (101,
        'Adam',
        'Tworkowski',
        '1980-01-05',
        '2004-08-01',
        01);
```

In order to make use of this handler and connect to the Teradata database in MindsDB, the following syntax can be used:

```sql
CREATE DATABASE teradata_db
WITH
   ENGINE = 'teradata',
   PARAMETERS = {
      "host": "192.168.0.41",
      "user": "dbc",
      "password": "dbc",
      "database": "HR"
   };
```

<Note>
The above example assumes usage of Teradata Vantage running on Oracle VirtualBox.
</Note>

You can use this established connection to query your table as follows:

```sql
SELECT *
FROM teradata_db.Employees;
```

On execution, we get:

```sql
+---------+-----------+------------+-------------+------------+----------------+
|GlobalID | FirstName | LastName   | DateOfBirth | JoinedDate | DepartmentCode |
+---------+-----------+------------+-------------+------------+----------------+
|101      | Adam      | Tworkowski | 1980-01-05  | 2004-08-01 | 1              |
+---------+-----------+------------+-------------+------------+----------------+
```
